#include <iostream>
#include <vector>

using namespace std;

const int	maxN = 10000 + 10;

vector<int>	edge_list[maxN];
int			n, m;
int			visit[maxN], s[maxN];

int dfs(int u)
{
	int ret = s[u];
	visit[u] = true;
	for (int i = 0; i < edge_list[u].size(); ++i)
	{
		int v = edge_list[u][i];
		if (!visit[v]) ret += dfs(v);
	}
	return ret;
}

int	main()
{
	int task;
	cin >> task;
	while (task--)
	{
		scanf("%d%d", &n, &m);
		for (int i = 0; i < n; ++i)
		{
			scanf("%d", &s[i]);
			edge_list[i].clear();
		}
		for (int i = 0; i < m; ++i)
		{
			int x, y;
			scanf("%d%d", &x, &y);
			edge_list[x].push_back(y);
			edge_list[y].push_back(x);
		}
		memset(visit, 0, sizeof(visit));
		bool ret = true;
		for (int i = 0; i < n; ++i) 
			if (!visit[i] && dfs(i) != 0)
			{
				ret = false;
				break;
			}
		if (ret)
			puts("POSSIBLE");
		else 
			puts("IMPOSSIBLE");
	}
	return 0;
}